/*

#include <iostream>
using namespace std;

int main()
{
    long long n = 0, m = 0, a = 0, b = 0, count = 0;
    cin >> n;
    cin >> m;
    cin >> a;
    cin >> b;
    if (a > b)
    {
        long long num = (n / 2) > (m / 1) ? (m / 1) : (n / 2);
        count += num * a;
        n -= num * 2, m -= num;
        num = (n / 1) > (m / 2) ? (m / 2) : (n / 1);
        count += num * b;
    }
    else
    {
        long long num = (n / 1) > (m / 2) ? (m / 2) : (n / 1);
        count += num * b;
        n -= num, m -= num * 2;
        num = (n / 2) > (m / 1) ? (m / 1) : (n / 2);
        count += num * a;
    }
    cout << count;
    return 0;
}

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    long long n = 0, flag = 1;
    vector<long long> prices(n);
    cin >> n;
    for (long long i = 0; i < n; i++)
        cin >> prices[i];
    // money[0] = -prices[0];
    // for (int i = 1, j = 1; i < n - 1; i++)
    // {
    //     if (prices[i + 1] < prices[i])
    //     {
    //         if (flag)
    //         {
    //             money[j] = prices[i] + money[j - 1];cout << money[j];
    //             flag = 0;
    //         }
    //         else {
    //             money[j] = money[j - 1] - prices[i];cout << money[j];
    //         }
    //         j++;
    //     }
    // }
    //cout << money.back();
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
    string s, ss;
    getline(cin, s);
    vector<string> vs;
    int cur = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == ' ')
        {
            int left = cur;
            cur = i + 1;
            while (left < i)
                ss += s[left];
            vs.push_back(ss);
        }
    }
    for (int i = vs.size(); i >= 0; i--)
        cout << vs[i] << " ";
    return 0;
}














*/